﻿using System;
using System.Collections.Generic;
using System.Text;

namespace BlogHunter
{
    class DatetimeDESCComparision : IComparer<BlogInfo>
    {
        public int Compare(BlogInfo x, BlogInfo y)
        {
            int result;

            if (BlogInfo.ReferenceEquals(x, y))
            {
                result = 0;
            }
            else
            {
                if (x == null)
                {
                    result = -1;
                }
                else if (y == null)
                {
                    result = 1;
                }
                else
                {
                    result = x.ArticleDateTime.CompareTo(y.ArticleDateTime) * (-1);
                }
            }
            return result;
        }
    }
}
